include "access_center.thrift"
include "device_manager.thrift"

namespace go camera_control


typedef string CameraType

const CameraType PLAY = "PLAY"
const CameraType REPLAY = "REPLAY"
const CameraType DEVICE_LIST = "DEVICE_LIST"
const CameraType DEVICE_ENTRY = "DEVICE_ENTRY"
const CameraType SUBSCRIBE = "SUBSCRIBE"
const CameraType NOTIFY = "NOTIFY"
const CameraType CONTROL = "CONTROL"
const CameraType RESPONSE = "RESPONSE"

typedef string NotifyType 

const NotifyType CATALOG          = "CATALOG"
const NotifyType MOBILE_POSITION  = "MOBILE_POSITION"
const NotifyType ALARM            = "ALARM"
const NotifyType KEEP_ALIVE       = "KEEP_ALIVE"

typedef string StreamType
const StreamType PULL = "PULL"
const StreamType PUSH = "PUSH"


typedef string ResultType
const ResultType RESULT_OK = "OK"
const ResultType RESULT_ERROR = "ERROR"

//节点
struct Node {
    1: string DeviceID
    2: string IP
    3: i32 Port
    4: string Area
    5: i32 Grade   //级别
}

//视频头
struct CameraHeader {
    1: Node From
    2: Node To
    3: string VideoID
    4: CameraType VideoType
}

//控制设备请求
struct DeviceControlRequest {
    1: CameraHeader CameraHeader
    2: string PTZCmd
    3: string TeleBoot
    4: string GuardCmd
    5: string AlarmCmd
    6: DragZoom DragZoomIn
    7: DragZoom DragZoomOut
}

//视频框
struct DragZoom {
    1: i64 Length
    2: i64 Width
    3: i64 MidPointX
    4: i64 MidPointY
    5: i64 LengthX
    6: i64 WidthY
}

//控制设备响应
struct DeviceControlResponse  {
    1:string	clientID
    2:string	deviceID
    3:string 	result   //返回信息
}

//订阅
struct SubscribeRequest {
    1: CameraHeader CameraHeader
    2: NotifyType SubscribeType
}

//报警通知
struct AlarmNotifyRequest {
    1: CameraHeader CameraHeader
    2: NotifyType NotifyType = ALARM
    3: string AlarmPriority
    4: string AlarmMethod
    5: i64 AlarmTime
}

//心跳通知
struct KeepaliveNotifyRequest {
    1: CameraHeader CameraHeader
    2: NotifyType NotifyType = KEEP_ALIVE
    3: string Status
    4: list<device_manager.Device> DeviceList
}


//地理位置变更
struct MobilePositionNotifyRequest {
    1: CameraHeader CameraHeader
    2: NotifyType NotifyType = MOBILE_POSITION
    3: i64 Time
    4: string Longitude 
	5: string Latitude 
}

//设备目录,变更
struct CatalogNotifyRequest {
    1: CameraHeader CameraHeader
    2: NotifyType NotifyType = CATALOG
    3: list<device_manager.Device> DeviceList
}

//实时播放
struct PlayRequest {
    1: CameraHeader CameraHeader
    2: string StreamType
    3: string SDPBody
}

//历史视频
struct ReplayRequest {
    1: CameraHeader CameraHeader
    2: string StreamType
    3: string SDPBody
    4: i64 StartTime
    5: i64 EndTime
}

//视频响应
struct PlayResponse {
    1: CameraHeader CameraHeader
    2: Response Response
    3: StreamType StreamType
    4: string URL
}

//历史视频响应
struct ReplayResponse {
    1: CameraHeader CameraHeader
    2: Response Response
    3: StreamType StreamType
    4: i64 StartTime
    5: i64 EndTime
    6: string URL
}

//设备列表
struct DeviceListRequest {
    1: CameraHeader CameraHeader
}

//设备历史文件列表
struct HistoryFile {
    1: string DeviceID  //设备ID
    2: string StartTime //开始时间
    3: string EndTime   //结束时间
    4: i64 FileSize //文件大小
}

//设备接入
struct DeviceEntryRequest {
    1: CameraHeader CameraHeader
}

//data 响应
struct Response {
    1: CameraHeader CameraHeader
    2: ResultType Result
}

//设备列表 响应
struct DeviceListResponse {
    1: Response Response
    2: list<device_manager.Device> DeviceList
}

//设备接入 响应
struct DeviceEntryResponse {
    1: Response Response
    2: access_center.DccCenter dccCentre
}

// 校时
struct TimingRequect{
    1: CameraHeader CameraHeader
    2: string timeZone
}

//校时 响应
struct TimingResponse{
    1: Response Response
    2: string timeZone
    3: i64 timeStamp
}

